package com.huika.renrench.control.main.epship.adap;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.huika.lib.utils.MoneyShowTool;
import com.huika.renrench.GlobalApp;
import com.huika.renrench.R;
import com.huika.renrench.control.common.base.BaseAda;
import com.huika.renrench.support.bean.EnshipProject;

/**
 * @author chenyuan
 * @date：2015年6月2,下午2:15:30
 * @describe:创业项目详情adapter
 */
public class EntrepreneurshipProjectAdapter extends BaseAda<EnshipProject> {

	/**
	 * @param context
	 */
	public EntrepreneurshipProjectAdapter(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		// View view = null;
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.item_enship_project,
					parent, false);
			holder = new ViewHolder();
			
			holder.iv_img = (ImageView) convertView.findViewById(R.id.iv_img);
			holder.tv_name = (TextView) convertView.findViewById(R.id.tv_name);
			holder.tv_keyWord = (TextView) convertView
					.findViewById(R.id.tv_keyWord);
			holder.tv_describe = (TextView) convertView
					.findViewById(R.id.tv_describe);
			holder.tv_location = (TextView) convertView
					.findViewById(R.id.tv_location);
			holder.tv_classify = (TextView) convertView
					.findViewById(R.id.tv_classify);
			convertView.setTag(holder);

		} else {
			holder = (ViewHolder) convertView.getTag();
		}

		setDataFromNet(holder, position);

		return convertView;
	}


	/**
	 * @author cy
	 * @date 2015年6月2日,下午3:48:47
	 * @param holder
	 * @param position
	 */
	private void setDataFromNet(ViewHolder holder, int position) {
		// TODO Auto-generated method stub
		EnshipProject item = getItem(position);
		holder.tv_name.setText(item.name);
		holder.tv_keyWord.setText(item.keywords);
		holder.tv_describe.setText(item.description);
		holder.tv_location.setText(item.location);
		holder.tv_classify.setText(item.categoryIds);
		
		
		GlobalApp.loadImgLoader(holder.iv_img, item.investImg);
	}

	private class ViewHolder {
		public ImageView iv_img;
		public TextView tv_name, tv_keyWord, tv_describe, tv_location,tv_classify;
	}

	
}
